home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr36 / mapl0301.zip / RCHAT300.STB < prev    next >
Text File  |  1993-04-13  |  6KB  |  185 lines

  1. '
  2. ' RChat300  --  Or, RBBS-Chat, release 3.00.  A character by character
  3. '               internode chat program..
  4. '
  5. '  Not the worlds prettiest, or cleanest code.. but I'm under no illusions..
  6. '
  7. '  Copyright 1989-1990 By John Morris  All Rights Reserved
  8. '  modifications for rbbs17.4 by Pete Eibl
  9. '
  10. '  I'm not a big fan of global variables, but here goes..
  11. '
  12. '  $INCLUDE: 'RBBS-VAR.MOD'   'RBBS-VAR.BAS minus the DEF FN...
  13. '
  14.    DEFINT A - Z
  15.    COMMON Shared /Chat/ DoTrueChat, HasPaged, UpperNode, LowerNode, SaveToDisk
  16.    COMMON Shared /Chat/ NodesToSquelch$
  17.    COMMON SHARED /ChatField/ ChatActivity$, PagingNode$, PrivateFor$
  18.    COMMON SHARED /ChatField/ ChatInput$, ChatName$, InTrueChat$
  19.    COMMON SHARED /ChatField/ TrueChatIndex$, SavingToDisk$, BBSActivity$
  20. '
  21. 59800 ' $SUBTITLE: 'LogNewForChat - Save user info for chat'
  22. ' $PAGE
  23. '
  24. '  NAME    -- LogNewForChat
  25. '
  26. '  INPUTS  -- Zmaxnodes -- needed for creation of RBBSCHAT.DEF
  27. '
  28. '  OUTPUTS -- Updates the node record in RBBSCHAT.DEF with this users
  29. '             name and chat activity (always "I") when the user logs on.
  30. '
  31. '  PURPOSE -- See OUTPUTS. Also, if no RBBSCHAT.DEF is not found, one will be
  32. '             created.
  33. '
  34.       SUB LogNewForChat(ZMaxNodes) STATIC
  35.       CALL FindItX (ZChatFileName$, 9)
  36.       REM ** If "RBBSCHAT.DEF" does not exist, then create it **
  37.  
  38.       IF NOT ZOK THEN
  39.          CALL OpenWrk9 (ZChatFileName$)
  40.          FIELD 9, 128 AS TempNode$
  41.          LSET TempNode$ = SPACE$(128)
  42.          FOR Index = 1 TO ZMaxNodes
  43.             CALL LockIt9 (Index, ZFalse)
  44.          NEXT
  45.       END IF
  46.  
  47.       ChatIndex = ZNodeRecIndex - 1
  48.       CLOSE 9
  49.       CALL OpenWrk9 (ZChatFileName$)
  50.       CALL Field9
  51.       CALL LockIt9 (ChatIndex, ZTrue)
  52.       LSET ChatActivity$ = "I"    ' I means inactive
  53.       LSET PagingNode$ = MKI$(0)
  54.       LSET ChatName$ = SPACE$(31)
  55.  
  56.       IF ZActiveUserName$ = ZSysopPswd1$ + " " + ZSysopPswd2$ THEN
  57.          LSET ChatName$ = "SYSOP"
  58.        ELSE
  59.          LSET ChatName$ = ZActiveUserName$
  60.       END IF
  61.  
  62.       LSET ChatInput$ = SPACE$(72)
  63.       LSET InTrueChat$ = "I"
  64.       CALL LockIt9 (ChatIndex, ZFalse)
  65.       CLOSE 9
  66.       END SUB
  67.  
  68. 59810 ' $SUBTITLE: 'CBCHECK - Check for a page attempt'
  69. ' $PAGE
  70. '
  71. '  NAME    -- CBCHECK
  72. '
  73. '  INPUTS  -- NONE
  74. '
  75. '  OUTPUTS -- ChatActivity$   Changed to reflect whether or not they
  76. '                             are going to chat
  77. '             WillChat        If WillChat is TRUE, then the user will
  78. '                             automatically be thrust unawares into
  79. '                             chat mode.. They said yes... didn't they?
  80. '
  81. '  PURPOSE -- Check to see if we have been paged from another node
  82. '
  83.       SUB CBCheck(WillChat) STATIC
  84.       WillChat = ZFalse
  85.       exit sub
  86.       END SUB
  87. 59820 ' $SUBTITLE: 'PageEm - attempt to page another user to chat'
  88. ' $PAGE
  89. '
  90. '  NAME    -- PageEm
  91. '
  92. '  INPUTS  -- ShowOnly         Show whos is on the other nodes only
  93. '             Zmaxnodes    Number of nodes in this system
  94. '
  95. '  OUTPUTS -- HasPaged        -1 exit chat mode
  96. '                              0 don't check for reply to page
  97. '                              1 - Zmaxnodes check for page reply
  98. '
  99. '  PURPOSE -- Page another user on the system and set up for a reply
  100. '             from the other user
  101. '
  102.       SUB PageEm(CurrentNodeIndex, ZMaxNodes, ShowOnly) STATIC
  103.  
  104.       REM ** Page 'Em only needs access to the COMMON variable HasPaged **
  105.       SHARED HasPaged
  106.  
  107.       CALL WhosOn (ZMaxNodes)
  108.       CALL SkipLine(1)
  109.       END SUB
  110.  
  111. 59830 ' $SUBTITLE: 'CBTrueChat - The letter by letter chat'
  112. ' $PAGE
  113. '
  114. '  NAME    -- CBTrueChat
  115. '
  116. '  INPUTS  -- Zmaxnodes
  117. '
  118. '  INTERNAL - NodesToSquelch$      STRING OF NODES NOT TO RECEIVE TEXT FROM
  119. '             HasPaged             NODE (IF ANY) THAT THIS USER PAGED
  120. '             CurrentNodeIndex     NODE RECORD IN "RBBSCHAT.DEF"
  121. '             ChatActivity$        CURRENT STATUS OF EACH NODE
  122. '             PagingNode$          NODE WHICH HAS PAGED THIS ONE
  123. '             ChatInput$           CURRENT TEXT INPUT BY USER FOR CHATTING
  124. '             ChatName$            NAME OF USER ON EACH NODE (NOT CURRENTLY USED)
  125. '             SquelchIt            BOOLEAN - MEANS NODE IS IGNORED
  126. '             ZUserIn$()           USED TO SAVE CURRENT STATUS OF EACH NODE
  127. '                                  THIS INFO IS LATER COMPARED, AND IF THAT
  128. '                                  STATUS IS CHANGED, THEN THE USER IS NOTIFIED
  129. '                                  OF THE CHANGE
  130. '             DoTrueChat           Means we are in a true chat mode, we'll
  131. '                                  only check one node for input
  132. '
  133. '
  134. '  OUTPUTS -- NONE
  135. '
  136. '  PURPOSE -- To allow users to chat between nodes in several different
  137. '             ways.
  138. '
  139.       SUB CBTrueChat(Zmaxnodes) STATIC
  140.        CALL QuickTput1 ( "Chat Not avaiable on this system")
  141.     Exit Sub
  142.     End Sub
  143.  
  144.     
  145.  
  146. REM **
  147. REM ** Save what a user is doing in the BBS.. for W)hos on mods..... **
  148. REM **
  149. 59910 SUB SaveUserActivity(Activity$, NodeRecordIndex, ReadIt) STATIC
  150.  
  151.       ChatNodeIndex = NodeRecordIndex - 1
  152.  
  153.       CLOSE 9
  154.       CALL OpenWrk9 (ZChatFileName$)
  155.       CALL Field9
  156.  
  157.       IF ReadIt THEN
  158.          CALL LockIt9(ChatNodeIndex, ZTrue)
  159.          Activity$ = BBSActivity$
  160.        ELSE
  161.          CALL LockIt9(ChatNodeIndex, ZTrue)
  162.          LSET BBSActivity$ = Activity$
  163.          CALL LockIt9(ChatNodeIndex, ZFalse)
  164.       END IF
  165.  
  166.       IF NOT ReadIt THEN
  167.          CLOSE 9
  168.       END IF
  169.  
  170.       END SUB
  171.  
  172. 59990 SUB Field9 STATIC
  173.       REM ** all of these variables are SHARED between all subprograms in **
  174.       REM ** this module (RCHAT300.BAS)                                   **
  175.       FIELD 9, 1 AS ChatActivity$, _
  176.                2 AS PagingNode$,   _
  177.                2 AS PrivateFor$,   _
  178.               72 AS ChatInput$,    _
  179.               31 AS ChatName$,     _
  180.                1 AS InTrueChat$,   _
  181.                2 AS TrueChatIndex$,_
  182.                1 AS SavingToDisk$, _
  183.                1 AS BBSActivity$
  184.       END SUB
  185.